How To's
OCR Our OCR service is running on a Windows machine on AWS. How to log into the OCR machine To access and operate the machine, use rdesktop: from a terminal window enter this command: rdesktop -g 1440x900 -u Administrator ec2-54-212-180-142.us-west-2.compute.amazonaws.com -p "=.m6UXnh7q&" How to start the OCR server (Play Framework) 1. Log into the AWS instance 2. Open a console window 3. Change directory: cd c:/dealsumm/ocrserver 4. Launch the webserver: play run ocrserver How to view our ABBYY Licenses 1. Log into the AWS instance 2. Click "Start" icon (top left corner) -> Open "License Manager" 3. Under "Licenses" you will see our licenses. Click on one for more info. To see and/or modify which license is currently in use: # Open the following file: C:\Program Files\dealsummocr\SamplesConfig.cs # Search the file for the string "license_key". Django web application On Amazon production machine we run Django user Apache via mod_wsgi How to log into the Amazon instances To log into the Linux instance where Django is running: ssh -i .ssh/amazon-new-ubuntu.pem ubuntu@ec2-54-214-252-217.us-west-2.compute.amazonaws.com How to launch/restart Apache Once logged into the instance, run the following command to launch Apache (Djagno will be automatically started): apachectl start To force restart Apache (Djagno will be restarted automatically): apachectl -k restart How to launch the application not via Apache (for development purposes): In order to launch the application, follow these steps: 1. Open a terminal window (alt-ctrl-t) 2. Source the Django environment: source ~/django17_env/bin/activate 3. Change directory to the webapp directory cd ~/dealthing/webapp/ 4. Launch the Django process: python manage.py runserver 0.0.0.0:8000 5. Launch the Celery worker process: python manage.py celery worker -concurrency=1 --loglevel=info python manage.py celery worker -c 1 -l info -Q s3_tasks 6. Launch SwampDragon - see separate section below Celery How to view the queue status Point your browser to the following address: http:// :15672/ user: guest password: guest How to purge the celery queues # kill the celery processes # Run the following commands: source ~/django17_env/bin/activate cd ~/dealthing/webapp/ celery purge # to purge the main queue celery amqp queue.purge QUEUE_NAME # to purge a specific queue - celery/s3_tasks/predict_queue How to extend PhpMyAdmin session timeout 1. Open a terminal session and cd to /etc/php5/apache2/ 2. Open the file php.ini for edit: sudo nano php.ini 3. Search for the variable maxlifetime and change it's value. 4. Save and exit. 5. Open up PhpMyAdmin (on the browser). 6. Go to settings -> features 7. Change the 'login cookie validity' value to the same value you set on step 3. 8 You're done! How to set up SwampDragon # sudo apt-get install redis-server # source ~/django-env/bin/activate # pip install swampdragon Launching SwampDragon # Go to dealthings/webapp # Make sure you have the following entry in your local system_config.ini (dealthing/webapp/dealthing/system_config.ini) - Your own machine: SERVER_URL=http://localhost:9999/ Amazon: SERVER_URL=http://:9999/ # python manage.py run_swampdragon Export/Import Model How to export model: 1.Open a terminal window. 2. Source the Django environment and change directory: 0 source ~/django17_env/bin/activate 1 cd ~/dealthing/webapp/ 3. Find the model's id in SQL ClassifyModel table. 4. Run the export command: 2 python manage.py export_classifymodel ' 2 ''Export file: "/xxx/xxx/dealthing/webapp/exports/Name.Date.tar.gz" How to transfer export file: 1.To Amazon machine: * Make sure you have the .pem file to use as SSH key (.ssh/amazon-new-ubuntu.pem). * Run the following command: 3 '''sudo scp -i ubuntu@www.dealsumm.com:~/dealthing/webapp/exports/ 2. To a local machine: send the export file however you want. How to import model: 1.For Amazon: Log into Amazon machine: 4 sudo ssh -i ubuntu@www.dealsumm.com 2. Source the Django environment and change directory into the webapp directory: 5 source ~/django17_env/bin/activate 6 cd ~/dealthing/webapp 3. Run the import command: 7 'python manage.py import_classifymodel ' 'Predict' Troubleshooting When 'predict' doesn't show results in the new app: # Try predict in the old app. If it works then the server-side is ok. Then: # Restart swampdragon # In the 'predict' tab in Chrome, open the Developer Tools drawer (F12) # In the Network tab, check "Disable cache" # Reload the page (F5)